﻿
namespace CsvSegítő.typeconverter
{
    using System;
    using System.Globalization;
    public class NullableUInt32Converter : NullableConverter<UInt32?>
    {
        private readonly UInt32Converter uint32Converter;

        public NullableUInt32Converter()
            : this(CultureInfo.InvariantCulture)
        {
        }

        public NullableUInt32Converter(IFormatProvider formatProvider)
        {
            uint32Converter = new UInt32Converter(formatProvider);
        }

        protected override bool InternalConvert(string value, out UInt32? result)
        {
            result = default(UInt32?);

            UInt32 innerConverterResult;
            if (!uint32Converter.TryConvert(value, out innerConverterResult)) return false;
            result = innerConverterResult;

            return true;
        }
    }
}
